package mr

//
// RPC definitions.
//
// remember to capitalize all names.
//

import (
	"os"
	"strconv"
)

//
// example to show how to declare the arguments
// and reply for an RPC.
//

type ExampleArgs struct {
	X int
}

type ExampleReply struct {
	Y int
}

type GetTaskParam struct {
	WorkerID  int
	TaskState int 		//节点工作情况   0：无任务 1：任务执行中 2：任务执行完成 3：任务执行失败
	TaskID   int
}

type GetTaskRes struct {
	WorkerID  int
	TaskType int 		// 0:不派活 1：mp任务 2：reduce任务
	TaskID   int
	NReduce  int
	Files   []string
}

type HeatbeatReq struct {
	WorkerID int
}

type HeatbeatResp struct {
	CoordinatorState int   //1：正常
}

type GetWorkIDReq struct {
	
}

type GetWorkIDResp struct {
	WorkerID int   
}

// Add your RPC definitions here.

// Cook up a unique-ish UNIX-domain socket name
// in /var/tmp, for the coordinator.
// Can't use the current directory since
// Athena AFS doesn't support UNIX-domain sockets.
func coordinatorSock() string {
	s := "/var/tmp/5840-mr-"
	s += strconv.Itoa(os.Getuid())
	return s
}
